import db from './localstorage'

export function hasPermission(permissions, authCode) {
  if (authCode === undefined) {
    return true
  }
  if (permissions.includes(authCode)) {
    return true
  }
  return false
}

export function hasPermissionInDB(authCode) {
  const permissions = getPermission()
  return hasPermission(permissions, authCode)
}

export function getPermission() {
  const permissions = db.get('PERMISSIONS')
  return permissions
}

